/**
 * 
 */
package com.ctg.payroll2.service.sysadmin.impl;

import java.util.List;

import com.ctg.payroll2.bean.po.SysUser;
import com.ctg.payroll2.service.sysadmin.LoginService;
import com.ctg.platform.orm.ibatis.IbatisEntityDao;

/**
 * @author 鲁力 2009-8-28 下午06:59:50
 *
 */
@SuppressWarnings("unchecked")
public class LoginServiceImpl implements LoginService {
	private IbatisEntityDao ibatisEntityDao;
	/**
	 * @param ibatisEntityDao 设置ibatisEntityDao
	 */
	public void setIbatisEntityDao(IbatisEntityDao ibatisEntityDao) {
		this.ibatisEntityDao = ibatisEntityDao;
	}
	@SuppressWarnings("unchecked")
	public SysUser getCurrentUserByLoginName(String name, SysUser user) {
		try {
			List<SysUser> list = ibatisEntityDao.getSqlMapClient().queryForList("login.getCurrentUserByLoginName", name);
			if(list.size()>0){
				user = list.get(0);
			}else{
				throw new Exception("Inner error");
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return user;
	}

}
